package com.xxb.task.xxljob;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

/**
 * @author panghu
 * @version 1.0.0
 * @createTime 2023年04月06日 19:19:00
 * @Description
 */
@Component
@Slf4j
public class MyXXJobDemo {

    @Value("${server.port}")
    private Integer port;

    @XxlJob("myXXLJobHandler")
    public ReturnT<String> myXXLJobHandler(String... params) throws Exception {
        log.info(XxlJobHelper.getJobParam() + "--->" + XxlJobHelper.getShardIndex() + "--->" +port);
        Thread.sleep(4000);
        XxlJobHelper.handleSuccess("执行成功....");
        return ReturnT.SUCCESS;
    }


}
